home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 183 / dpcs0503.iso / Components / Microsoft ASP / _SETUP.1 / ASPComponents.jar / asp / nfx / MSDBUpdate / MSDBUpdate.class (.txt)
Encoding:
Java Class File  |  1998-11-20  |  15.8 KB  |  648 lines

  1. package asp.nfx.MSDBUpdate;
  2.  
  3. import asp.util.EResourceUtil;
  4. import asp.util.ResourceUtil;
  5. import com.netobjects.nfc.api.CStringArray;
  6. import com.netobjects.nfc.api.ComponentApp;
  7. import com.netobjects.nfc.api.DAssetManager;
  8. import com.netobjects.nfc.api.DDrawFormButton;
  9. import com.netobjects.nfc.api.DLayout;
  10. import com.netobjects.nfc.api.DMessageBox;
  11. import com.netobjects.nfc.api.DRect;
  12. import com.netobjects.nfc.api.IDInspector;
  13.  
  14. public class MSDBUpdate extends ComponentApp {
  15.    String name;
  16.    String buttonAction;
  17.    String buttonType;
  18.    int buttonImage;
  19.    String buttonText;
  20.    String queryComponent;
  21.    String tableName;
  22.    int primaryKeyCount;
  23.    String[] primaryKeyFieldNames;
  24.    String[] primaryKeyFieldDataTypes;
  25.    int successPage;
  26.    int errorPage;
  27.    private String INCLUDEFILE_SUBDIR = "asp";
  28.    String preName = "amaspComponent_";
  29.    DDrawFormButton component;
  30.    String codebase;
  31.    DAssetManager assMan;
  32.    protected static transient ResourceUtil resUtil = null;
  33.    static final int MAXKEYFIELDCOUNT = 10;
  34.    static final int COMP_WIDTH = 8;
  35.    static final int COMP_HEIGHT = 22;
  36.    static final String SCRIPTDELIMOPEN = "<SCRIPT RUNAT=SERVER LANGUAGE=JSCRIPT>\n";
  37.    static final String SCRIPTDELIMCLOSE = "</SCRIPT>\n";
  38.    static final int MAXASSET = 50;
  39.    int[] assetControl;
  40.    int assetCount;
  41.    boolean published = false;
  42.    // $FF: synthetic field
  43.    static Class class$asp$nfx$MSDBUpdate$MSDBUpdate;
  44.  
  45.    public String onInstall(DAssetManager cam, String codebase) {
  46.       this.assMan = cam;
  47.       return "MSDBUpdate";
  48.    }
  49.  
  50.    public void onDrop(DLayout layout, DRect r, int fDrop) {
  51.       if (fDrop == 1) {
  52.          this.allocateFieldsArray();
  53.          this.name = resUtil.getString("value.name");
  54.          this.tableName = "";
  55.          this.buttonAction = "0";
  56.          this.buttonType = "1";
  57.          this.buttonImage = 0;
  58.          this.buttonText = this.getDefaultText(this.getButtonAction(Integer.parseInt(this.buttonAction, 10)));
  59.          this.queryComponent = resUtil.getString("value.query");
  60.          this.primaryKeyCount = 1;
  61.          this.primaryKeyFieldNames[0] = resUtil.getString("value.kfldname");
  62.          this.primaryKeyFieldDataTypes[0] = "0";
  63.          this.assetControl = new int[50];
  64.          this.component = new DDrawFormButton();
  65.          this.codebase = this.component.getCodeBase();
  66.          this.component.setText(this.buttonText);
  67.          this.component.SetPositionRect(r.getLeft(), r.getTop(), r.getRight(), r.getBottom());
  68.          this.component.setName("MSDBUpdate1");
  69.          layout.AddObject(this.component);
  70.       }
  71.    }
  72.  
  73.    public void onInspect(CStringArray Names, CStringArray Types) {
  74.       Names.Set(resUtil.getString("property.name"));
  75.       Types.Set("String");
  76.       Names.Set(resUtil.getString("property.query"));
  77.       Types.Set("String");
  78.       Names.Set(resUtil.getString("property.btnaction"));
  79.       Types.Set("Set(" + resUtil.getString("option.btnaction") + ")");
  80.       Names.Set(resUtil.getString("property.btntype"));
  81.       Types.Set("Set(" + resUtil.getString("option.btntype") + ")");
  82.       Names.Set(resUtil.getString("property.btnimage"));
  83.       Types.Set("Image");
  84.       Names.Set(resUtil.getString("property.btntext"));
  85.       Types.Set("String");
  86.       Names.Set(resUtil.getString("property.table"));
  87.       Types.Set("String");
  88.       Names.Set(resUtil.getString("property.kfldcount"));
  89.       Types.Set("Collection");
  90.  
  91.       for(int cnt = 0; cnt < this.primaryKeyCount; ++cnt) {
  92.          Names.Set(resUtil.getString("property.kfldname") + " " + Integer.toString(cnt + 1));
  93.          Types.Set("String");
  94.          Names.Set(resUtil.getString("property.kfldtype") + " " + Integer.toString(cnt + 1));
  95.          Types.Set("Set(" + resUtil.getString("option.kfldtype") + ")");
  96.       }
  97.  
  98.       Names.Set(resUtil.getString("property.successpage"));
  99.       Types.Set("Link");
  100.       Names.Set(resUtil.getString("property.errorpage"));
  101.       Types.Set("Link");
  102.    }
  103.  
  104.    public String PropertyListener(String Event, String Value, int Get, int propIndex, IDInspector insp) {
  105.       if (Get == 1) {
  106.          if (Event.compareTo(resUtil.getString("property.name")) == 0) {
  107.             this.name = this.component.getName();
  108.             return this.name;
  109.          }
  110.  
  111.          if (Event.compareTo(resUtil.getString("property.btnaction")) == 0) {
  112.             return this.buttonAction;
  113.          }
  114.  
  115.          if (Event.compareTo(resUtil.getString("property.btntype")) == 0) {
  116.             return this.buttonType;
  117.          }
  118.  
  119.          if (Event.compareTo(resUtil.getString("property.btnimage")) == 0) {
  120.             return Integer.toString(this.buttonImage);
  121.          }
  122.  
  123.          if (Event.compareTo(resUtil.getString("property.btntext")) == 0) {
  124.             this.buttonText = this.component.getText();
  125.             return this.buttonText;
  126.          }
  127.  
  128.          if (Event.compareTo(resUtil.getString("property.query")) == 0) {
  129.             return this.queryComponent;
  130.          }
  131.  
  132.          if (Event.compareTo(resUtil.getString("property.table")) == 0) {
  133.             return this.tableName;
  134.          }
  135.  
  136.          if (Event.compareTo(resUtil.getString("property.kfldcount")) == 0) {
  137.             return Integer.toString(this.primaryKeyCount);
  138.          }
  139.  
  140.          if (Event.compareTo(resUtil.getString("property.successpage")) == 0) {
  141.             return Integer.toString(this.successPage);
  142.          }
  143.  
  144.          if (Event.compareTo(resUtil.getString("property.errorpage")) == 0) {
  145.             return Integer.toString(this.errorPage);
  146.          }
  147.  
  148.          for(int cnt = 0; cnt < this.primaryKeyCount; ++cnt) {
  149.             if (Event.compareTo(resUtil.getString("property.kfldname") + " " + Integer.toString(cnt + 1)) == 0) {
  150.                return new String(this.primaryKeyFieldNames[cnt]);
  151.             }
  152.  
  153.             if (Event.compareTo(resUtil.getString("property.kfldtype") + " " + Integer.toString(cnt + 1)) == 0) {
  154.                return new String(this.primaryKeyFieldDataTypes[cnt]);
  155.             }
  156.          }
  157.       } else if (Event.compareTo(resUtil.getString("property.name")) == 0) {
  158.          if (this.isValidName(Value)) {
  159.             this.name = Value;
  160.             this.component.setName(this.name);
  161.          }
  162.       } else if (Event.compareTo(resUtil.getString("property.btnaction")) == 0) {
  163.          this.buttonAction = Value;
  164.          if (this.queryComponent.compareTo("") == 0 && Value.compareTo("0") != 0) {
  165.             this.queryComponent = resUtil.getString("value.query");
  166.             insp.OnPropertyChanged(-1);
  167.          }
  168.       } else if (Event.compareTo(resUtil.getString("property.btntype")) == 0) {
  169.          if (this.getButtonType(Integer.parseInt(Value, 10)).compareTo("image") == 0) {
  170.             this.buttonText = resUtil.getString("value.btntextimg");
  171.             this.component.setText(this.buttonText);
  172.          } else {
  173.             this.buttonText = this.getDefaultText(this.getButtonAction(Integer.parseInt(this.buttonAction, 10)));
  174.             this.component.setText(this.buttonText);
  175.             this.buttonImage = -1;
  176.          }
  177.  
  178.          this.buttonType = Value;
  179.          insp.OnPropertyChanged(-1);
  180.       } else if (Event.compareTo(resUtil.getString("property.btnimage")) == 0) {
  181.          this.buttonImage = Integer.parseInt(Value, 10);
  182.          if (this.buttonType.compareTo("0") != 0) {
  183.             DMessageBox msg = new DMessageBox();
  184.             msg.Warning(resUtil.getString("error.settoimage"));
  185.             this.buttonType = "0";
  186.             this.buttonText = "<IMAGE>";
  187.             this.component.setText(this.buttonText);
  188.             insp.OnPropertyChanged(-1);
  189.          }
  190.       } else if (Event.compareTo(resUtil.getString("property.btntext")) == 0) {
  191.          this.buttonText = Value;
  192.          if (this.buttonType.compareTo("0") == 0) {
  193.             DMessageBox msg = new DMessageBox();
  194.             msg.Warning(resUtil.getString("error.settotext"));
  195.             this.buttonType = "1";
  196.             this.buttonImage = -1;
  197.             insp.OnPropertyChanged(-1);
  198.          }
  199.  
  200.          this.component.setText(this.buttonText);
  201.          this.component.Invalidate(true);
  202.       } else if (Event.compareTo(resUtil.getString("property.query")) == 0) {
  203.          if (this.buttonAction.compareTo("0") != 0) {
  204.             if (this.isValidName(Value)) {
  205.                this.queryComponent = Value;
  206.             }
  207.          } else {
  208.             this.queryComponent = Value;
  209.          }
  210.       } else if (Event.compareTo(resUtil.getString("property.table")) == 0) {
  211.          this.tableName = Value;
  212.       } else if (Event.compareTo(resUtil.getString("property.kfldcount")) == 0) {
  213.          int myCnt = Integer.parseInt(Value, 10);
  214.          if (this.isValidCollection(myCnt)) {
  215.             DMessageBox msg = new DMessageBox();
  216.             int answer = 1;
  217.             if (myCnt > 10) {
  218.                answer = msg.Alert(resUtil.getString("error.maxfield") + " " + Integer.toString(10) + ".");
  219.                if (answer == 1) {
  220.                   myCnt = 10;
  221.                }
  222.             }
  223.  
  224.             if (answer == 1) {
  225.                this.primaryKeyCount = myCnt;
  226.  
  227.                for(int cnt = this.primaryKeyCount; cnt < 10; ++cnt) {
  228.                   this.primaryKeyFieldNames[cnt] = "";
  229.                   this.primaryKeyFieldDataTypes[cnt] = "-1";
  230.                }
  231.  
  232.                insp.OnPropertyChanged(-1);
  233.             }
  234.          }
  235.       } else if (Event.compareTo(resUtil.getString("property.successpage")) == 0) {
  236.          this.successPage = Integer.parseInt(Value, 10);
  237.       } else if (Event.compareTo(resUtil.getString("property.errorpage")) == 0) {
  238.          this.errorPage = Integer.parseInt(Value, 10);
  239.       } else {
  240.          for(int cnt = 0; cnt < this.primaryKeyCount; ++cnt) {
  241.             if (Event.compareTo(resUtil.getString("property.kfldname") + " " + Integer.toString(cnt + 1)) == 0) {
  242.                this.primaryKeyFieldNames[cnt] = Value;
  243.             }
  244.  
  245.             if (Event.compareTo(resUtil.getString("property.kfldtype") + " " + Integer.toString(cnt + 1)) == 0) {
  246.                this.primaryKeyFieldDataTypes[cnt] = Value;
  247.             }
  248.          }
  249.       }
  250.  
  251.       return "";
  252.    }
  253.  
  254.    public void onCopy() {
  255.       this.component.setName(this.name);
  256.       this.component.setText(this.buttonText);
  257.       String[] primaryKeyFieldNamesOld = this.primaryKeyFieldNames;
  258.       String[] primaryKeyFieldDataTypesOld = this.primaryKeyFieldDataTypes;
  259.       this.primaryKeyFieldNames = new String[10];
  260.       this.primaryKeyFieldDataTypes = new String[10];
  261.  
  262.       for(int i = 0; i < this.primaryKeyCount; ++i) {
  263.          this.primaryKeyFieldNames[i] = new String(primaryKeyFieldNamesOld[i]);
  264.          this.primaryKeyFieldDataTypes[i] = new String(primaryKeyFieldDataTypesOld[i]);
  265.       }
  266.  
  267.       this.assMan.CopyAsset(this.successPage);
  268.       this.assMan.CopyAsset(this.errorPage);
  269.       int[] assetControlOld = this.assetControl;
  270.  
  271.       for(int i = 0; i < this.assetCount; ++i) {
  272.          this.assetControl[i] = assetControlOld[i];
  273.          if (this.assetControl[i] != 0) {
  274.             this.assMan.CopyAsset(this.assetControl[i]);
  275.          }
  276.       }
  277.  
  278.    }
  279.  
  280.    public void onPublish(DAssetManager asm, int context) {
  281.       DLayout cidLayout = this.component.getLayout();
  282.       String NestedDir = "";
  283.       String homePath = cidLayout.GetHomePath();
  284.       if (homePath.compareTo("..\\") == 0) {
  285.          NestedDir = ".";
  286.       }
  287.  
  288.       String IncludeFile = "<!--#INCLUDE FILE=\"" + NestedDir + "./assets/lib/MSDBUpdate.inc\"-->\n";
  289.       this.removeAssets();
  290.       this.published = true;
  291.       int javaScriptAsset = this.assMan.AddAsset(this.codebase + "MSDBUpdateHandler.asp", "HTML", "assets\\lib");
  292.       this.assetControl[this.assetCount] = javaScriptAsset;
  293.       this.assMan.SetPublishAssetMode(this.assetControl[this.assetCount], 453);
  294.       ++this.assetCount;
  295.       int javaScriptFile = this.assMan.AddAsset(this.codebase + "MSDBUpdate.inc", "JavaScript", "assets\\lib");
  296.       this.assetControl[this.assetCount] = javaScriptFile;
  297.       ++this.assetCount;
  298.       String HTMLHead = "";
  299.       String HTMLBefore = "";
  300.       String HTMLAfter = "";
  301.       String actionPath = asm.GetAssetRelativeLocation(javaScriptAsset, context, 0);
  302.       asm.GetAssetRelativeLocation(this.buttonImage, context, 0);
  303.       String errorPath = asm.GetAssetRelativeLocation(this.errorPage, context, 1);
  304.       String successPath = asm.GetAssetRelativeLocation(this.successPage, context, 1);
  305.       if (successPath.length() > 0) {
  306.          if (successPath.substring(0, 2).compareTo("./") == 0) {
  307.             successPath = "." + successPath;
  308.          }
  309.  
  310.          successPath = "../" + successPath;
  311.       }
  312.  
  313.       if (errorPath.length() > 0) {
  314.          if (errorPath.substring(0, 2).compareTo("./") == 0) {
  315.             errorPath = "." + errorPath;
  316.          }
  317.  
  318.          errorPath = "../" + errorPath;
  319.       }
  320.  
  321.       HTMLHead = "\n";
  322.       HTMLHead = HTMLHead + "<SCRIPT RUNAT=SERVER LANGUAGE=JSCRIPT>\n\n";
  323.       HTMLHead = HTMLHead + "//Created by MSDBUpdate component in NetObjects Fusion\n";
  324.       HTMLHead = HTMLHead + "//Construct field arrays\n";
  325.       HTMLHead = HTMLHead + this.name + "primaryKeyFieldNames = new Array(" + this.primaryKeyCount + ");\n";
  326.       HTMLHead = HTMLHead + this.name + "primaryKeyFieldDataTypes = new Array(" + this.primaryKeyCount + ");\n";
  327.       HTMLHead = HTMLHead + "\n";
  328.  
  329.       for(int i = 0; i < this.primaryKeyCount; ++i) {
  330.          HTMLHead = HTMLHead + this.name + "primaryKeyFieldNames[" + Integer.toString(i) + "] = \"" + this.primaryKeyFieldNames[i] + "\";\n";
  331.          HTMLHead = HTMLHead + this.name + "primaryKeyFieldDataTypes[" + Integer.toString(i) + "] = \"" + this.getDataType(Integer.parseInt(this.primaryKeyFieldDataTypes[i], 10)) + "\";\n";
  332.       }
  333.  
  334.       HTMLHead = HTMLHead + "\n";
  335.       HTMLHead = HTMLHead + "\n";
  336.       HTMLHead = HTMLHead + "//" + resUtil.getString("text.comment") + "\n";
  337.       HTMLHead = HTMLHead + this.name + " = new MSDBUpdate(\n";
  338.       HTMLHead = HTMLHead + "                                \"" + this.name + "\",\n";
  339.       HTMLHead = HTMLHead + "                                \"" + this.getButtonAction(Integer.parseInt(this.buttonAction, 10)) + "\",\n";
  340.       HTMLHead = HTMLHead + "                                \"" + this.queryComponent + "\",\n";
  341.       HTMLHead = HTMLHead + "                                \"" + this.tableName + "\",\n";
  342.       HTMLHead = HTMLHead + "                                \"" + successPath + "\",\n";
  343.       HTMLHead = HTMLHead + "                                \"" + errorPath + "\",\n";
  344.       HTMLHead = HTMLHead + "                                " + Integer.toString(this.primaryKeyCount) + ",\n";
  345.       HTMLHead = HTMLHead + "                                " + this.name + "primaryKeyFieldNames,\n";
  346.       HTMLHead = HTMLHead + "                                null,\n";
  347.       HTMLHead = HTMLHead + "                                " + this.name + "primaryKeyFieldDataTypes\n";
  348.       HTMLHead = HTMLHead + ");\n";
  349.       HTMLHead = HTMLHead + "\n";
  350.       HTMLHead = HTMLHead + "</SCRIPT>\n\n";
  351.       cidLayout.setHTMLBefore(IncludeFile + HTMLHead);
  352.       cidLayout.setFormAction(actionPath);
  353.       String theHTML = "\n<%";
  354.       theHTML = theHTML + "\n" + this.name + ".render()";
  355.       theHTML = theHTML + "\n%>";
  356.       theHTML = theHTML + "\n<!Button Type = " + this.getButtonType(Integer.parseInt(this.buttonType, 10)) + ">";
  357.       theHTML = theHTML + "\n<INPUT NAME = \"" + this.preName + this.name + "\"";
  358.       if (this.getButtonType(Integer.parseInt(this.buttonType, 10)).compareTo("image") == 0) {
  359.          theHTML = theHTML + " BORDER = 0 TYPE = \"IMAGE\"";
  360.          theHTML = theHTML + " SRC = \"" + asm.GetAssetRelativeLocation(this.buttonImage, context, 0) + "\"";
  361.       } else {
  362.          theHTML = theHTML + " TYPE = \"SUBMIT\"";
  363.          theHTML = theHTML + " VALUE = \"" + this.buttonText + "\"";
  364.       }
  365.  
  366.       theHTML = theHTML + ">";
  367.       theHTML = theHTML + "\n<!--";
  368.       this.component.setHTMLBefore(theHTML);
  369.       this.component.setHTMLAfter("-->");
  370.    }
  371.  
  372.    protected void finalize() {
  373.       this.removeAssets();
  374.       this.assMan.RemoveAsset(this.successPage);
  375.       this.assMan.RemoveAsset(this.errorPage);
  376.    }
  377.  
  378.    public void onUnInstall(DAssetManager cam) {
  379.    }
  380.  
  381.    void allocateFieldsArray() {
  382.       this.primaryKeyFieldNames = new String[10];
  383.       this.primaryKeyFieldDataTypes = new String[10];
  384.  
  385.       for(int cnt = 0; cnt < 10; ++cnt) {
  386.          this.primaryKeyFieldDataTypes[cnt] = "";
  387.          this.primaryKeyFieldNames[cnt] = "";
  388.       }
  389.  
  390.    }
  391.  
  392.    public boolean isValidName(String testString) {
  393.       boolean result = true;
  394.       if (testString.compareTo("") == 0) {
  395.          DMessageBox msg = new DMessageBox();
  396.          msg.Warning(resUtil.getString("error.validname"));
  397.          result = false;
  398.       }
  399.  
  400.       return result;
  401.    }
  402.  
  403.    public boolean isValidCollection(int testNo) {
  404.       boolean result = true;
  405.       if (testNo < 0) {
  406.          DMessageBox msg = new DMessageBox();
  407.          msg.Warning(resUtil.getString("error.validnumber"));
  408.          result = false;
  409.       }
  410.  
  411.       return result;
  412.    }
  413.  
  414.    public String getDefaultText(String myValue) {
  415.       String result = "";
  416.       if (myValue.compareTo("add") == 0) {
  417.          result = resUtil.getString("value.btntextadd");
  418.       } else if (myValue.compareTo("delete") == 0) {
  419.          result = resUtil.getString("value.btntextmod");
  420.       } else if (myValue.compareTo("modify") == 0) {
  421.          result = resUtil.getString("value.btntextdel");
  422.       }
  423.  
  424.       return result;
  425.    }
  426.  
  427.    public String getDataType(int myValue) {
  428.       int maxCount = 4;
  429.       String result = "";
  430.       String[] myArray = new String[maxCount];
  431.       if (myValue >= 0 & myValue < maxCount) {
  432.          myArray[0] = "string";
  433.          myArray[1] = "number";
  434.          myArray[2] = "boolean";
  435.          myArray[3] = "date";
  436.          result = myArray[myValue];
  437.       }
  438.  
  439.       return result;
  440.    }
  441.  
  442.    public String getButtonType(int myValue) {
  443.       int maxCount = 2;
  444.       String result = "";
  445.       String[] myArray = new String[maxCount];
  446.       if (myValue >= 0 & myValue < maxCount) {
  447.          myArray[0] = "image";
  448.          myArray[1] = "text";
  449.          result = myArray[myValue];
  450.       }
  451.  
  452.       return result;
  453.    }
  454.  
  455.    public String getButtonAction(int myValue) {
  456.       int maxCount = 3;
  457.       String result = "";
  458.       String[] myArray = new String[maxCount];
  459.       if (myValue >= 0 & myValue < maxCount) {
  460.          myArray[0] = "add";
  461.          myArray[1] = "modify";
  462.          myArray[2] = "delete";
  463.          result = myArray[myValue];
  464.       }
  465.  
  466.       return result;
  467.    }
  468.  
  469.    private void removeAssets() {
  470.       if (this.published) {
  471.          for(int i = 0; i < this.assetCount; ++i) {
  472.             this.assMan.RemoveAsset(this.assetControl[i]);
  473.          }
  474.       }
  475.  
  476.       this.assetCount = 0;
  477.    }
  478.  
  479.    public static ResourceUtil initResourceUtil(Class compClass) {
  480.       ResourceUtil _ru = null;
  481.  
  482.       try {
  483.          _ru = new ResourceUtil("asp.nfx.res", compClass);
  484.       } catch (EResourceUtil e) {
  485.          System.err.println(((Throwable)e).getMessage());
  486.       }
  487.  
  488.       return _ru;
  489.    }
  490.  
  491.    public String propertyManager(String Event, String Value, int Get) {
  492.       if (Get == 1) {
  493.          if (Event.compareTo(resUtil.getString("property.name")) == 0) {
  494.             this.name = this.component.getName();
  495.             return this.name;
  496.          }
  497.  
  498.          if (Event.compareTo(resUtil.getString("property.btnaction")) == 0) {
  499.             return this.buttonAction;
  500.          }
  501.  
  502.          if (Event.compareTo(resUtil.getString("property.btntype")) == 0) {
  503.             return this.buttonType;
  504.          }
  505.  
  506.          if (Event.compareTo(resUtil.getString("property.btnimage")) == 0) {
  507.             return Integer.toString(this.buttonImage);
  508.          }
  509.  
  510.          if (Event.compareTo(resUtil.getString("property.btntext")) == 0) {
  511.             this.buttonText = this.component.getText();
  512.             return this.buttonText;
  513.          }
  514.  
  515.          if (Event.compareTo(resUtil.getString("property.query")) == 0) {
  516.             return this.queryComponent;
  517.          }
  518.  
  519.          if (Event.compareTo(resUtil.getString("property.table")) == 0) {
  520.             return this.tableName;
  521.          }
  522.  
  523.          if (Event.compareTo(resUtil.getString("property.kfldcount")) == 0) {
  524.             return Integer.toString(this.primaryKeyCount);
  525.          }
  526.  
  527.          if (Event.compareTo(resUtil.getString("property.successpage")) == 0) {
  528.             return Integer.toString(this.successPage);
  529.          }
  530.  
  531.          if (Event.compareTo(resUtil.getString("property.errorpage")) == 0) {
  532.             return Integer.toString(this.errorPage);
  533.          }
  534.  
  535.          for(int cnt = 0; cnt < this.primaryKeyCount; ++cnt) {
  536.             if (Event.compareTo(resUtil.getString("property.kfldname") + " " + Integer.toString(cnt + 1)) == 0) {
  537.                return new String(this.primaryKeyFieldNames[cnt]);
  538.             }
  539.  
  540.             if (Event.compareTo(resUtil.getString("property.kfldtype") + " " + Integer.toString(cnt + 1)) == 0) {
  541.                return new String(this.primaryKeyFieldDataTypes[cnt]);
  542.             }
  543.          }
  544.       } else if (Event.compareTo(resUtil.getString("property.name")) == 0) {
  545.          if (this.isValidName(Value)) {
  546.             this.name = Value;
  547.             this.component.setName(this.name);
  548.          }
  549.       } else if (Event.compareTo(resUtil.getString("property.btnaction")) == 0) {
  550.          this.buttonAction = Value;
  551.          if (this.queryComponent.compareTo("") == 0 && Value.compareTo("0") != 0) {
  552.             this.queryComponent = resUtil.getString("value.query");
  553.          }
  554.       } else if (Event.compareTo(resUtil.getString("property.btntype")) == 0) {
  555.          if (this.getButtonType(Integer.parseInt(Value, 10)).compareTo("image") == 0) {
  556.             this.buttonText = resUtil.getString("value.btntextimg");
  557.             this.component.setText(this.buttonText);
  558.          } else {
  559.             this.buttonText = this.getDefaultText(this.getButtonAction(Integer.parseInt(this.buttonAction, 10)));
  560.             this.component.setText(this.buttonText);
  561.             this.buttonImage = -1;
  562.          }
  563.  
  564.          this.buttonType = Value;
  565.       } else if (Event.compareTo(resUtil.getString("property.btnimage")) == 0) {
  566.          this.buttonImage = Integer.parseInt(Value, 10);
  567.          if (this.buttonType.compareTo("0") != 0) {
  568.             DMessageBox msg = new DMessageBox();
  569.             msg.Warning(resUtil.getString("error.settoimage"));
  570.             this.buttonType = "0";
  571.             this.buttonText = "<IMAGE>";
  572.             this.component.setText(this.buttonText);
  573.          }
  574.       } else if (Event.compareTo(resUtil.getString("property.btntext")) == 0) {
  575.          this.buttonText = Value;
  576.          if (this.buttonType.compareTo("0") == 0) {
  577.             DMessageBox msg = new DMessageBox();
  578.             msg.Warning(resUtil.getString("error.settotext"));
  579.             this.buttonType = "1";
  580.             this.buttonImage = -1;
  581.          }
  582.  
  583.          this.component.setText(this.buttonText);
  584.          this.component.Invalidate(true);
  585.       } else if (Event.compareTo(resUtil.getString("property.query")) == 0) {
  586.          if (this.buttonAction.compareTo("0") != 0) {
  587.             if (this.isValidName(Value)) {
  588.                this.queryComponent = Value;
  589.             }
  590.          } else {
  591.             this.queryComponent = Value;
  592.          }
  593.       } else if (Event.compareTo(resUtil.getString("property.table")) == 0) {
  594.          this.tableName = Value;
  595.       } else if (Event.compareTo(resUtil.getString("property.kfldcount")) == 0) {
  596.          int myCnt = Integer.parseInt(Value, 10);
  597.          if (this.isValidCollection(myCnt)) {
  598.             DMessageBox msg = new DMessageBox();
  599.             int answer = 1;
  600.             if (myCnt > 10) {
  601.                answer = msg.Alert(resUtil.getString("error.maxfield") + " " + Integer.toString(10) + ".");
  602.                if (answer == 1) {
  603.                   myCnt = 10;
  604.                }
  605.             }
  606.  
  607.             if (answer == 1) {
  608.                this.primaryKeyCount = myCnt;
  609.  
  610.                for(int cnt = this.primaryKeyCount; cnt < 10; ++cnt) {
  611.                   this.primaryKeyFieldNames[cnt] = "";
  612.                   this.primaryKeyFieldDataTypes[cnt] = "-1";
  613.                }
  614.             }
  615.          }
  616.       } else if (Event.compareTo(resUtil.getString("property.successpage")) == 0) {
  617.          this.successPage = Integer.parseInt(Value, 10);
  618.       } else if (Event.compareTo(resUtil.getString("property.errorpage")) == 0) {
  619.          this.errorPage = Integer.parseInt(Value, 10);
  620.       } else {
  621.          for(int cnt = 0; cnt < this.primaryKeyCount; ++cnt) {
  622.             if (Event.compareTo(resUtil.getString("property.kfldname") + " " + Integer.toString(cnt + 1)) == 0) {
  623.                this.primaryKeyFieldNames[cnt] = Value;
  624.             }
  625.  
  626.             if (Event.compareTo(resUtil.getString("property.kfldtype") + " " + Integer.toString(cnt + 1)) == 0) {
  627.                this.primaryKeyFieldDataTypes[cnt] = Value;
  628.             }
  629.          }
  630.       }
  631.  
  632.       return "";
  633.    }
  634.  
  635.    // $FF: synthetic method
  636.    static Class class$(String class$) {
  637.       try {
  638.          return Class.forName(class$);
  639.       } catch (ClassNotFoundException forName) {
  640.          throw new NoClassDefFoundError(((Throwable)forName).getMessage());
  641.       }
  642.    }
  643.  
  644.    static {
  645.       resUtil = initResourceUtil(class$asp$nfx$MSDBUpdate$MSDBUpdate != null ? class$asp$nfx$MSDBUpdate$MSDBUpdate : (class$asp$nfx$MSDBUpdate$MSDBUpdate = class$("asp.nfx.MSDBUpdate.MSDBUpdate")));
  646.    }
  647. }
  648.